package com.cxz.food.exception;


public class CustomException extends Exception {

    private Integer code;
    private String message;

    public CustomException(ExceptionEnum exceptionEnum){
        setMessage(exceptionEnum.getMsg());
        setCode(exceptionEnum.getCode());
    }

    /**
     * 自定义错误信息
     * @param message
     * @param code
     */
    public CustomException(String message, Integer code) {
        super(message);
        setCode(code);

    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
